package com.androidhuman.example.mapsv2example;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;
import android.widget.Toast;

public class SplashActivity extends Activity
{
	 private AnimationDrawable frameAnimation;
	    private ImageView view;
	
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        initialize();
        
    	
        
        view = (ImageView) findViewById(R.id.splash_ani);
        
        // animation_list.xml 를 ImageView 백그라운드에 셋팅한다
        view.setBackgroundResource(R.drawable.animation_transition);
  
        // 이미지를 동작시키기위해  AnimationDrawable 객체를 가져온다.
        frameAnimation = (AnimationDrawable) view.getBackground();
        
        frameAnimation.start();
    }

    private void initialize()
    {
        Handler handler =    new Handler()
                                     {
                                         @Override
                                         public void handleMessage(Message msg)
                                         {
                                        	frameAnimation.stop();
                                     		startActivity(new Intent(getApplicationContext(), IntroActivity.class));// 액티비티 종료
                                     		
                                            finish();

                                         }
                                     };

        handler.sendEmptyMessageDelayed(0, 2800);// ms, 3초후 종료시킴
    }
}